<template>
    <div>
        <el-container>
            <el-aside width="200px">
                <div class="title">
                    科泰教育CRM
                </div>
                <div>
                    <el-menu :router="true" default-active="1-4-1" class="el-menu-vertical-demo" :collapse="isCollapse">
                        <template v-for="menu in menuList">
                            <el-submenu :index="menu.rightCode" v-if="menu.rightParentCode == 'ROOT_MENU'" :key="menu.rightCode">
                                <template slot="title">
                                    <i class="el-icon-menu"></i>
                                    <span slot="title">{{ menu.rightText }}</span>
                                </template>

                                <template v-for="menu2 in menuList">
                                    <el-menu-item :index="menu2.rightUrl" v-if="menu.rightCode == menu2.rightParentCode"
                                        :key="menu2.rightCode">{{ menu2.rightText }}</el-menu-item>
                                </template>
                            </el-submenu>

                        </template>

                    </el-menu>

                </div>
            </el-aside>
            <el-container>
                <el-header>Header</el-header>
                <el-main >
                    <router-view></router-view>
                </el-main>
                <el-footer>Footer</el-footer>
            </el-container>
        </el-container>



    </div>
</template>

<script>
export default {
    data() {
        return {
            isCollapse: false,
            menuList: []
        }
    },
    methods: {
        goChild(url) {
            this.$router.push(url)
        }
    },
    mounted() {
        this.$axios
            .post(
                "/api/sysRight/listByUser"
            )
            .then((resp) => {
                // debugger
                if (resp.data) {
                   this.menuList=resp.data
                }
            })
            .catch((error) => {
                debugger;
                console.log(error);
            });
    },
}
</script>

<style>
.el-menu {
    text-align: left;
}

.title {
    font-size: 24px;
    height: 60px;
    line-height: 60px;
}

.el-header,
.el-footer {
    background-color: #B3C0D1;
    color: #333;
    text-align: center;
    line-height: 60px;
}

.el-aside {
    background-color: #D3DCE6;
    color: #333;
    text-align: center;
    /* line-height: 200px; */
    height: 98vh;
}

.el-main {
    background-color: #E9EEF3;
    color: #333;
    text-align: center;
    min-height: 80vh;
    /* line-height: 160px; */
}

body>.el-container {
    margin-bottom: 40px;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
    line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
    line-height: 320px;
}
.el-table{
    min-height: 58vh;
}
</style>